﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Rhino.Mocks;
using CID.Domain.Development;
using CID.Domain.Infrastructure;

namespace CID.Domain.Tests.Development
{
    static class StubsBuilder
    {
        public static IVersion BuildVersionStub(IComponent component = null, IRelease release = null)
        {
            var result = MockRepository.GenerateStub<IVersion>();
            result.Stub(x => x.Component).Return(component);
            result.Stub(x => x.Release).Return(release);

            return result;
        }

        public static IComponent BuildComponentStub(bool stubVersions = true, IActivationDeactivationDefinition activationDeactivationDefinition = null)
        {
            var result = MockRepository.GenerateStub<IComponent>();
            result.Name = Guid.NewGuid().ToString();
            if(stubVersions) result.Stub(x => x.Versions).Return(new IVersion[0]);
            result.Stub(x => x.ActivationDeactivationDefinition).Return(activationDeactivationDefinition);
            return result;
        }

        public static IRelease BuildReleaseStub(ReleaseStatus status = ReleaseStatus.Active)
        {
            var result = MockRepository.GenerateStub<IRelease>();
            result.Stub(x => x.Status).Return(status);
            return result;
        }
    }
}
